package FPGrowth

import java.io.File
import java.util

import org.apache.commons.io.FileUtils

object analyse {


  def main(args: Array[String]): Unit = {
    val inputFile1: String = "1ans"
    val map=new util.HashMap[String,Int]()

    FileUtils.readLines(new File(inputFile1)).forEach(
      line=>{
        val sts = line.split("\\|")
        val supp = sts(sts.length-1).toInt
//        println(supp)
//        if(sts.length==3&& !line.contains("电影"))
        val le=change(sts(0),",")+"|"+sts(sts.length-1)
          if(le.contains("性生活"))
          map.put(le,supp)
      }
    )
    val ls=new util.ArrayList[util.Map.Entry[String,Int]](map.entrySet())
    println(s"ls.size() = ${ls.size()}")
    ls.sort((e,a)=>a.getValue-e.getValue)
    ls.subList(0,math.min(ls.size(),100)).forEach(e=>println(e.getKey))
  }

  def change(str:String,split:String): String ={
    val sb=new StringBuilder
    str.split(split).foreach(e=> sb++=","+perProc.maps.get(e))
    sb.substring(1)
  }
}
